<?php 




class Zanshi
{
    public $name;
    public $age;
    public $gender;
    public function __set($property_name,$val)
    {
        echo "您调用了魔术方法__set，对私有属性{$property_name}进行了赋值{$val}的操作<br/>";
        $this->$property_name = $val;
    }
    public function __get($property_name)
    {
        echo "您调用了魔术方法__get，取到了私有属性{$property_name}的值<br/>";
        return $this->$property_name;
    }

}




 ?>